<?php

namespace app\admin\logic;

use app\common\logic\BaseLogic;
use app\common\model\mysql\OrderModel;
use app\common\model\mysql\ProjectModel;
use app\common\model\mysql\UserModel;

class IndexLogic extends BaseLogic
{
    public function index($requset)
    {

        $t = time();
        $start = mktime(0, 0, 0, date("m", $t), date("d", $t), date("Y", $t));
        $end = mktime(23, 59, 59, date("m", $t), date("d", $t), date("Y", $t));

        $projectNum = ProjectModel::getCount([]);
        $orderNum = OrderModel::getCount([]);
        $userNum = UserModel::getCount([]);
        $userDay = UserModel::getCount([['login_time', 'between', [$start, $end]]]);

        $order = OrderModel::getList([], [], [0, 4]);

        $orderTotal = count($order);

        $project = ProjectModel::getlist([], [], [0, 10]);


        return view('Index/index', compact('projectNum', 'orderNum', 'userNum', 'userDay', 'orderTotal', 'order', 'project'));
    }
}